package com.example.kt_base.s3

//TODO 41.Kotlin语法中异常处理与自定义异常特点
fun main() {

    try {
        var info: String? = null
        checkException(info)
        println(info!!.length)

    } catch (e: Exception) {
        println("${e.message}")
    }

}

fun checkException(info: String?) {
    info ?: throw CustomException()
}

class CustomException : IllegalArgumentException("你的代码不太严谨了")